package com.aionengine.gameserver.services.custom;

import com.aionengine.gameserver.controllers.NpcController;
import com.aionengine.gameserver.model.gameobjects.Creature;
import com.aionengine.gameserver.model.gameobjects.player.Player;
import com.aionengine.gameserver.model.gameobjects.player.RequestResponseHandler;
import com.aionengine.gameserver.network.aion.serverpackets.SM_QUESTION_WINDOW;
import com.aionengine.gameserver.utils.PacketSendUtility;

/**
 *
 * @author BlackCore
 */
public class PvPNPC extends NpcController {
    private NpcType nType;
	
		
	public PvPNPC(NpcType nType) {
		this.nType = nType;
	}
        public enum NpcType {
                FARM,
                MEDAL,
                PVP;
		
		
	}
        @Override
	public void onDialogRequest(final Player player) {
            String message = "APN desconocido. Notifique a la administracion.";
            switch (this.nType) {
                case MEDAL:
                    message = "Usted quiere conseguir monedas?";
                    break;
                case FARM:
                    message=  "Quieres ir a la finca?";
                    break;
                case PVP:
				message = "Usted quiere ir a la zona PvP?"
				+ "Elyos en ubicacion :" + PVPInstanceService.pvpInstance().getElyPlayersInside().size()
				+ "___"
				+ "Asmodian en ubicacion : " + PVPInstanceService.pvpInstance().getAsmoPlayersInside().size()
                                + "___"
                                + "PVP ubicacion actual : " + PVPInstanceService.getPVPInstanceMap().getRusname();
				break;
                            
            }
           RequestResponseHandler responseHandler = new RequestResponseHandler(player) {
                        @Override
			public void acceptRequest(Creature requester, Player responder) {
				switch (nType) {
                                    case MEDAL:
                                        PVPExchangeService.exchangeMedal(player);
                                        break;
                                    case FARM:
                                        Farm.teleportToFarm(player);
                                        break;
                                    case PVP:
                                        Teleport.teleportToPVP(player);
                                        break;
                                 
                                        
				}
				return;
			}
                        @Override
			public void denyRequest(Creature requester, Player responder) {
				return;
			}
		};
		boolean requested = player.getResponseRequester().putRequest(902247, responseHandler);
		if (requested) {
			PacketSendUtility.sendPacket(player, new SM_QUESTION_WINDOW(902247, 0, 10, message));
			return;
		}

            }
                    }